package com.xingongchang.baolebei.protocol;

import org.json.JSONException;
import org.json.JSONObject;

import com.external.activeandroid.Model;
import com.external.activeandroid.annotation.Column;
import com.external.activeandroid.annotation.Table;
import com.insthub.BeeFramework.view.SlideView;

@Table(name = "USER_TOPIC")
public class USER_TOPIC extends Model {
	
	public SlideView slideView;

	@Column(name = "is_top")
	public int is_top;

	@Column(name = "replycount")
	public int replycount;

	@Column(name = "unReadReplay")
	public int unReadReplay;

	@Column(name = "creaton")
	public String creaton;

	@Column(name = "title")
	public String title;

	@Column(name = "body")
	public String body;

	@Column(name = "topicid")
	public int topicid;

	@Column(name = "classid")
	public int classid;

	@Column(name = "isenable")
	public int isenable;

	public static USER_TOPIC fromJson(JSONObject jsonObject)
			throws JSONException {
		if (null == jsonObject) {
			return null;
		}
		USER_TOPIC localItem = new USER_TOPIC();

		localItem.title = jsonObject.optString("title");
		localItem.body = jsonObject.optString("body");
		localItem.replycount = jsonObject.optInt("replycount");
		localItem.creaton = jsonObject.optString("creaton");
		localItem.is_top = jsonObject.optInt("is_top");
		localItem.topicid = jsonObject.optInt("topicid");
		localItem.classid = jsonObject.optInt("classid");
		localItem.unReadReplay = jsonObject.optInt("unReadReplay");
		localItem.isenable = jsonObject.optInt("isenable");

		return localItem;
	}

}